package gui.view;

import java.awt.Rectangle;

import javax.swing.JPanel;

import com.nightpiter.model.objects.Station;

import model.MetroModel;
import model.ModelChangeListener;

public abstract class MetroView extends JPanel implements ModelChangeListener {
	public abstract void afterPanelInit();
	public static Rectangle getMapBounds() {

		float maxX=Float.NEGATIVE_INFINITY, minX=Float.POSITIVE_INFINITY,maxY=Float.NEGATIVE_INFINITY,minY=Float.POSITIVE_INFINITY;
		for(Station station:MetroModel.getInstance()) {
			maxX=Math.max(station.getPosition().x, maxX);
			maxY=Math.max(station.getPosition().y, maxY);
			minX=Math.min(station.getPosition().x, minX);
			minY=Math.min(station.getPosition().y, minY);
		}
		return new Rectangle((int)minX,(int)minY, (int)(maxX-minX), (int)(maxY-minY));

	}

}
